package com.xy.manage.service.impl;


import java.util.List;
import java.util.Map;
import java.util.Date;
import com.xy.core.util.BeanUtil;
import com.xy.common.page.Pagination;
import com.xy.core.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.xy.manage.dao.TmembernewsDao;
import com.xy.manage.model.Tmembernews;
import com.xy.manage.service.TmembernewsService;

@Service
@Transactional
public class TmembernewsServiceImpl extends BaseServiceImpl<Tmembernews> implements
		TmembernewsService {
	private TmembernewsDao tmembernewsDao;

	public TmembernewsServiceImpl(TmembernewsDao paramAppRoleDao) {
		super(paramAppRoleDao);
		this.tmembernewsDao = paramAppRoleDao;
	}

	@Override
	public boolean checkExist(String paraName, String paraValue) {
		return tmembernewsDao.checkExist("Tmembernews", paraName, paraValue);
	}

	@Override
	public List<Tmembernews> getTmembernews(Map<String, Object> map) {
		return tmembernewsDao.getTmembernews(map);
	}
	@Override
	public Pagination getTmembernewsByPage(Map<String, Object> map, int pageNo,
			int pageSize,String orderby,String order) {
		// TODO Auto-generated method stub
		return tmembernewsDao.getTmembernewsByPage(map, pageNo, pageSize,orderby,order);
	}
	 
   @Override
	public Tmembernews save(Tmembernews tmembernews) {
	//	tmembernews.setModtime(new Date());
		if(tmembernews.getNewsid()==null){
			//新增
        	return super.save(tmembernews);
		}else{
			//更新
			Tmembernews tmembernews1=tmembernewsDao.get(tmembernews.getNewsid());
			try {
				BeanUtil.copyNotNullProperties(tmembernews1, tmembernews);
			} catch (Exception e) {
				e.printStackTrace();
			}  
			return super.save(tmembernews1);
		}
	}
}